#define _CRT_SECURE_NO_WARNINGS	

#include<iostream>
#include<string>
using namespace std;

//class Person
//{
//public:
//	string _name;
//	int _age;
//};
//
//class Student : public Person
//{
//protected:
//	int _num;
//};
//
//class Teacher : public Person
//{
//protected :
//	int _id;
//};
//
//class Assistant : public Teacher, public Student
//{
//protected:
//	string _majorCourse;
//};
//
//
//int main()
//{
//	Assistant as;
//	as.Student::_age = 18;
//	as.Teacher::_age = 30;
//	//as._age = 19;
//
//	return 0;
//}


class A
{
public: 
	int _a;
};

class B : virtual public A
{
public:
	int _b;
};

class C : virtual public A
{
public:
	int _c;
};

class D : public B, public C
{
public:
	int _d;
};

//int main()
//{
//	D d;
//
//	d.B::_a = 1;
//	d.C::_a = 2;
//
//	d._b = 3;
//	d._c = 4;
//	d._d = 5;
//	d._a = 0;
//
//	return 0;
//}


int main()
{
	D d;
	d._a = 1;

	B b;
	b._a = 2;
	b._b = 3;

	B* ptr = &b;
	ptr->_a++;
	cout << d._a << endl;

	cout << b._a << endl;

	ptr = &d;
	ptr->_a++;

	cout << d._a << endl;

	return 0;
}
